home *** CD-ROM | disk | FTP | other *** search
- /**
- Text To Outlines.c
-
- This application will create a gxLine of text, and convert it to a gxPath gxShape. By changing the
- sample to a gxPath will give you the outlines of each character.
-
-
- NOTES:
- • This file requires the following files to run correctly:
- "graphics shell.c", "FontLibrary.c", "GraphicsDebugLibrary.c", "TransformLibrary.c".
-
- • This file prints the "best" in landscape mode.
-
- Change History:
-
- 4/96 bob Updated #includes to support changed GX Library names.
- Updated the note regarding the files needed to run.
- Updated the copyright date.
-
- ©1990-1996 Apple Computer, Inc.
- All rights reserved.
- **/
-
- #include <Events.h>
- #include <Windows.h>
-
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
- #include "FontLibrary.h"
- #include "graphics shell.h"
-
-
- //
- // Set up the title and size of the window
- //
- Str255 gWindowTitle = "\p Text To Outlines ";
- Rect gWindowQDRect = {50, 10, 280, 460};
-
- //
- // gGraphicsHeapSize sets the size of the graphics gxHeap created by calling the GXNewGraphicsClient routine
- // in main () within graphics shell.c. You can determine the amount of graphics gxHeap required by using GraphicsBug.
- // With gGraphicsHeapSize set to 15k, I had 4 free blocks left in the graphics gxHeap. Sounds good to me.
- //
- long gGraphicsHeapSize = 75;
-
- gxShape gTextOutlineShape;
-
-
-
- /*------ DoInitialization ---------------------------------------------------------------------------------*/
-
- void DoInitialization(aWindow)
- WindowPtr aWindow;
- {
- gxPoint textPostion;
- gxColor textOutlineColor;
-
- //
- // Set up the starting text postion. This location will be set up when we
- // create our text gxShape.
- //
- textPostion.x = ff(30);
- textPostion.y = ff(150);
-
- //
- // Create the text, and set the gxFont and size.
- //
- gTextOutlineShape = GXNewText(5,(unsigned char*)"Waves", &textPostion);
- SetShapeCommonFont(gTextOutlineShape, timesFont);
- GXSetShapeTextSize(gTextOutlineShape, ff(145));
-
- GXSetShapeType(gTextOutlineShape, gxPathType);
- GXSetShapeFill(gTextOutlineShape, gxClosedFrameFill);
- GXSetShapePen(gTextOutlineShape, ff(2));
- GXSetShapeStyleAttributes(gTextOutlineShape, gxOutsideFrameStyle);
-
-
- //
- // A gxColor, to run through hsv space with...
- //
- textOutlineColor.space = gxHSVSpace;
- textOutlineColor.profile = nil;
- textOutlineColor.element.hsv.hue = 0xD4DA;
- textOutlineColor.element.hsv.saturation = 0xD657;
- textOutlineColor.element.hsv.value = 0xFFFF;
-
- GXSetShapeColor(gTextOutlineShape, &textOutlineColor);
- }
-
-
-
- /*------ DoDraw ---------------------------------------------------------------------------------------*/
-
- void DoDraw(aWindow)
- WindowPtr aWindow;
- {
- GXDrawShape (gTextOutlineShape);
- }
-
-
- /*------ DoDispose -------------------------------------------------------------------------------------*/
-
- void DoDispose(aWindow)
- WindowPtr aWindow;
- {
- //
- // You should always dispose of your GX graphics objects before tossing your window. Why? It's generally good
- // form and this approach guarantees that everything is disposed. If you had not disposed of everything, the
- // call to DisposeWindow should dispose of the objects. If you are running the debugging version of the
- // SecretGraphics init with notices set, you will receive a notice that you had not disposed of everything. You
- // can turn notices on in this file by setting gDebugging = TRUE (above).
- //
- GXDisposeShape(gTextOutlineShape);
- GXDisposeShape(gWindowBoundsShape);
- DisposeWindow(aWindow);
- }
-
-
-
- /*------ DoClick ---------------------------------------------------------------------------------------*/
-
- void DoClick( orgMouseLoc, theWindow )
- gxPoint orgMouseLoc;
- WindowPtr theWindow;
- {
- }
-
-
- /*------ DoIdle ----------------------------------------------------------------------------------------*/
-
- void DoIdle(aWindow)
- WindowPtr aWindow;
- {
- }
-